<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>libwebsockets: lws_protocols Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="libwebsockets.org-logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libwebsockets
   </div>
   <div id="projectbrief">Lightweight C library for HTML5 websockets</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="classes.html"><span>Data&#160;Structure&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Data&#160;Fields</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('structlws__protocols.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-attribs">Data Fields</a>  </div>
  <div class="headertitle">
<div class="title">lws_protocols Struct Reference<div class="ingroups"><a class="el" href="group__Protocols-and-Plugins.html">Protocols and Plugins</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="libwebsockets_8h_source.html">libwebsockets.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:a0e63edb457a613c3fa4271e0a8f19624"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlws__protocols.html#a0e63edb457a613c3fa4271e0a8f19624">name</a></td></tr>
<tr class="separator:a0e63edb457a613c3fa4271e0a8f19624"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acabf94c1a9bfe7be0387fbb0e0c56b2d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__usercb.html#gad4fcb82e68d60ffacca61a3f783a0a2f">lws_callback_function</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlws__protocols.html#acabf94c1a9bfe7be0387fbb0e0c56b2d">callback</a></td></tr>
<tr class="separator:acabf94c1a9bfe7be0387fbb0e0c56b2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9bbd85f591ffb4259711cb5acbb05bea"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlws__protocols.html#a9bbd85f591ffb4259711cb5acbb05bea">per_session_data_size</a></td></tr>
<tr class="separator:a9bbd85f591ffb4259711cb5acbb05bea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0d1d4996d81b2f5e125bcec981e461c5"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlws__protocols.html#a0d1d4996d81b2f5e125bcec981e461c5">rx_buffer_size</a></td></tr>
<tr class="separator:a0d1d4996d81b2f5e125bcec981e461c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b632018590c2b1bbe43fbab6d5e6fac"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlws__protocols.html#a6b632018590c2b1bbe43fbab6d5e6fac">id</a></td></tr>
<tr class="separator:a6b632018590c2b1bbe43fbab6d5e6fac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3cbd903ad076736ae934a54cae36580e"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlws__protocols.html#a3cbd903ad076736ae934a54cae36580e">user</a></td></tr>
<tr class="separator:a3cbd903ad076736ae934a54cae36580e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>struct <a class="el" href="structlws__protocols.html">lws_protocols</a> - List of protocols and handlers client or server supports. </p>
</div><h2 class="groupheader">Field Documentation</h2>
<a class="anchor" id="acabf94c1a9bfe7be0387fbb0e0c56b2d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__usercb.html#gad4fcb82e68d60ffacca61a3f783a0a2f">lws_callback_function</a>* lws_protocols::callback</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The service callback used for this protocol. It allows the service action for an entire protocol to be encapsulated in the protocol-specific callback </p>

</div>
</div>
<a class="anchor" id="a6b632018590c2b1bbe43fbab6d5e6fac"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int lws_protocols::id</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>ignored by lws, but useful to contain user information bound to the selected protocol. For example if this protocol was called "myprotocol-v2", you might set id to 2, and the user code that acts differently according to the version can do so by switch (wsi-&gt;protocol-&gt;id), user code might use some bits as capability flags based on selected protocol version, etc. </p>

</div>
</div>
<a class="anchor" id="a0e63edb457a613c3fa4271e0a8f19624"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char* lws_protocols::name</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Protocol name that must match the one given in the client Javascript new WebSocket(url, 'protocol') name. </p>

</div>
</div>
<a class="anchor" id="a9bbd85f591ffb4259711cb5acbb05bea"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t lws_protocols::per_session_data_size</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Each new connection using this protocol gets this much memory allocated on connection establishment and freed on connection takedown. A pointer to this per-connection allocation is passed into the callback in the 'user' parameter </p>

</div>
</div>
<a class="anchor" id="a0d1d4996d81b2f5e125bcec981e461c5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t lws_protocols::rx_buffer_size</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>lws allocates this much space for rx data and informs callback when something came. Due to rx flow control, the callback may not be able to consume it all without having to return to the event loop. That is supported in lws.</p>
<p>This also controls how much may be sent at once at the moment, although this is likely to change. </p>

</div>
</div>
<a class="anchor" id="a3cbd903ad076736ae934a54cae36580e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* lws_protocols::user</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>ignored by lws, but user code can pass a pointer here it can later access from the protocol callback </p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>lib/<a class="el" href="libwebsockets_8h_source.html">libwebsockets.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="structlws__protocols.html">lws_protocols</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
